#include "freyalaunch.h"
#include "freyalog.h"
#include "freya_global.h"
#include <QCoreApplication>

int main(int argc, char *argv[])
{
    QCoreApplication a(argc, argv);

    //set current work path
    QDir::setCurrent(QCoreApplication::applicationDirPath());
//    FreyaLog::GetFreyaLog()->SetLogPath(PATH_LOG);
    qInstallMessageHandler(FreyaLog::FreyaLogMessage);
    qputenv("path", qgetenv("path").append(";").append(QDir(MODULEDIR).absolutePath().toLocal8Bit())
                                   .append(";").append(QDir(MODULEDEPENDDIR).absolutePath().toLocal8Bit()));

    QString launchKey = "Freya_7";
    if (1 < argc)
    {
        launchKey = QString::fromLocal8Bit(argv[1]);
    }
    FreyaLaunch l(launchKey);
    l.launch();

    return a.exec();
}
